function close_poup(){
		
		$("#show_info_2").remove();
		 $("#close_luu_2").remove();
		 $("#khung_bg_view").hide();
			
			}
		function close_thong_bao_show(){
		 $("#show_info").remove();
						$("#close_luu").remove();
			
			}		
			
	function close_khung_popup2(){
		$("#show_info_2").remove();
		 $("#close_luu_2").remove();
		  $("#khung_bg_view").hide();
	}							
			
function kiem_trthongtin(wth){

 var aheight = $("#lay_thong_tin_nam_hinh").height();
 $("#khung_bg_view").css('height',(aheight)); 
 var noidung=$("#show_thong_tin").html();
 if(noidung!=''){
 $("#khung_bg_view").show();
 }
 
	var myWidth;
	var myHeight;
	var chia;
	var moi;var hedu;var hemoi;
	
	if(typeof(window.innerWidth) == 'number'){ 
	//Non-IE 
		 myWidth = window.innerWidth;
		 myHeight = window.innerHeight; 
	} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { 
		 //IE 6+ in 'standards compliant mode' 
		 myWidth = document.documentElement.clientWidth; 
		 myHeight = document.documentElement.clientHeight; 
	} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) { 
		 //IE 4 compatible 
		 myWidth = document.body.clientWidth; 
		 myHeight = document.body.clientHeight; 
	} 
	$("#lay_thong_tin_nam_hinh").attr('myWidth',myWidth);
	$("#lay_thong_tin_nam_hinh").attr('pupupWidth',wth);
	$("#lay_thong_tin_nam_hinh").attr('myHeight',myHeight);
	
var viewPortHeight = parseInt(document.documentElement.clientHeight);
	var scrollHeight = parseInt(document.body.getBoundingClientRect().top);		
		
		 var cont = document.getElementById('popup_photo');	  
		var dai=cont.offsetHeight.toString();
		if(dai<100){
			thu=250;
			}else{
		hedu =parseInt(viewPortHeight-dai);
		hemoi=hedu/2;
		thu=Math.abs(scrollHeight)+hemoi;
		}

		chia=myWidth-wth;
		moi=chia/2;
		
		$(".popup_photo").css("top",Math.abs(thu)+"px");
		$(".popup_photo").css("left",moi+"px");
		
}

function pageLoad(){

 var cont = document.getElementById('popup_photo');	  
var rong=cont.offsetWidth.toString();
kiem_trthongtin(rong);

}

function set_chieucao(){
	var hedu;var hemoi;
	var viewPortHeight = parseInt(document.documentElement.clientHeight);
	var scrollHeight = parseInt(document.body.getBoundingClientRect().top);		
 
 var dai = $("#popup_photo").height();

		if(dai<100){
			thu=250;
		$(".popup_photo").css("top",Math.abs(thu)+"px");
		
		}else if(dai<viewPortHeight){
		hedu =parseInt(viewPortHeight-dai);
		hemoi=hedu/2;
		thu=Math.abs(scrollHeight)+hemoi;
		$(".popup_photo").css("top",Math.abs(thu)+"px");	
		}
		
	
}

$(window).scroll(function () { 
	
	set_chieucao();
	
    });
